<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/common/taglibs.jsp"%>
<html>
<head>
<title>报销申请管理</title>
<%@include file="/common/ec.jsp"%>
<%@include file="/common/extjs.jsp" %>
<%@include file="/common/meta.jsp"%>
<script type="text/javascript">
function remove(id, parentReimbId){
	if (confirm("您确认要删除此报销申请单吗？")){
		window.location.href="${ctx}/reimb/removeChild.do?model.id=" + id + "&parentReimbId=" + parentReimbId;
	}
}
</script>
</head>
<body>
<div class="x-panel">
<div class="x-toolbar barBorder">
 <div style="margin: 5px;" align="center">子报销单信息&nbsp;</div>
 <s:hidden name="parentReimbId"/>
</div>
<div class="x-panel-body">
<ec:table items="items" var="item" retrieveRowsCallback="limit" sortRowsCallback="limit" 
	    action="childIndex.do"
		useAjax="true" doPreload="false"
		maxRowsExported="10000000" 
		pageSizeList="8,50,100" 
		editable="false" 
		sortable="false"	
		rowsDisplayed="8"	
		generateScript="true"	
		resizeColWidth="false"	
		classic="false"	
		width="100%" 	
		height="220px"	
		minHeight="220"
		toolbarContent="navigation|pagejump|pagesize|refresh|extend|status">
	<ec:row style="height: auto;">
	    <ec:column width="30" property="_s" title="No." value="${GLOBALROWCOUNT}" sortable="false" style="text-align:center"/>
		<ec:column width="140" property="singleNo" title="报销单号">
		    <a href="view.do?model.id=${item.id}" target="_blank" ><font color="blue">${item.singleNo}</font></a>	
		</ec:column>				
        <ec:column width="140" property="dept.name" title="部门名称" ellipsis="true"/>
		<ec:column width="160" property="project.name" title="项目名称" ellipsis="true"/>
		<ec:column width="90" property="createDate" title="制单时间" style="text-align:center" cell="date"/>
		<ec:column width="100" property="amount" title="报销金额" style="text-align:right" format="#####0.00" cell="number"/>		
	
 						    	
		<ec:column width="140" property="_0" title="操作" style="text-align:center" sortable="false">
		    <c:choose>
		      <c:when test="${item.audStatus != 'unsend'}">
			     <font color="#999999">编辑</font> | 		      
			     <font color="#999999">删除</font> |  
		      </c:when>
		      <c:otherwise>
		      	 <a href="#" onclick="editChild('${item.id}','${parentReimbId}')">编辑</a> | 
		      	 <a href="#" onclick="remove('${item.id}','${parentReimbId}')" title="${item.singleNo}">删除</a> |       	 
		      </c:otherwise>
		    </c:choose>
		    <a href="view.do?model.id=${item.id}" target="_blank" title="${item.singleNo}">查看</a>	
		</ec:column>
	</ec:row>
	
	<s:if test="#attr.items.size()!=0">
		<ec:extendrow>
			<tr style="background-color: #ffe3ee">
				<td colspan="5" align="right" id="No1"
					style="font-weight: bold; border-top: 0px; border-bottom: 0px; border-left: 0px;">报销金额合计：</td>
				<td style="font-weight: bold; word-wrap: break-word; word-break: break-all; text-align: right;">
				<fmt:formatNumber value="${childReimbTotal}" pattern="#,##0.00"/> 	</td>
				<td>&nbsp;</td>
			</tr>
		</ec:extendrow>
	</s:if>	
</ec:table>
</div>
</div>
<script type="text/javascript">
parent.document.getElementById('balance').value = '${childReimbTotal}';
parent.document.getElementById('reimbTotal').value = '${childReimbTotal}';
function refresh() {
  ECSideUtil.reload('ec');
}

function editChild(reimbId, parentReimbId) { 
	var url = '${ctx}/reimb/editChild.do?model.id=' + reimbId + '&parentReimbId=' + parentReimbId;
	var styles = "dialogWidth:920px; dialogHeight:465px; status:no; scroll:yes; help:no";
	var reimbChild = window.showModalDialog(url, null, styles);
    if (reimbChild.flag != null) {
    	window.location.href = '${ctx}/reimb/childIndex.do?parentReimbId=' + parentReimbId;	
    }	
}
</script>
</body>
</html>